<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no, email=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <script>

        Array.prototype.unique2 = function(){
            this.sort(); //先排序
            var res = [this[0]];
            for(var i = 1; i < this.length; i++){
                if(this[i] !== res[res.length - 1]){
                    res.push(this[i]);
                }
            }
            return res;
        }
        var arr = [5,0, 'a', 'a', '你好', '你好', 'c', 'c', 5, 0]
        alert(arr.unique2());
    </script>
</head>
<body>

</body>
</html>